package demo4;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-03-17
 * Time: 22:00
 */
public class Test {
    public static void main(String[] args) {
        Dog dog1 = new Dog("二哈",2);
        Dog dog2 = new Dog("二哈",2);
        System.out.println(dog1 == dog2);
        System.out.println(dog1.equals(dog2));
        System.out.println("==============");
        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());
    }
    public static void func(Animal animal){
        animal.eat();
    }
    public static void walk(IRunning iRunning){
        iRunning.run();
    }
    public static void swim(ISwimming iSwimming){
        iSwimming.swim();
    }
    public static void fly(IFly iFly){
        iFly.fly();
    }
    public static void main1(String[] args) {
        func(new Dog("旺财",2));
        walk(new Dog("二哈",2));
        swim(new Dog("二哈",2));
        func(new Bird("小鸟",3));
        fly(new Bird("小鸟",3));
    }
}
